# 启动程序，通用模块
import os

from py.storage import AppObj, SettingUtil
from py.storage.SettingUtil import setting
from py.uitls import WinUtil, FileUtil, PyUtil
from py.uitls.Logger import myLogger


# 初始化系统配置
def common_init():
    AppObj.device_id = WinUtil.get_device_id()
    myLogger.info('设备ID：' + AppObj.device_id)

    AppObj.base_path = PyUtil.get_base_path()
    myLogger.info("Base路径：" + AppObj.base_path)

    # 设置base路径，解决Style文件，找不到的问题
    os.chdir(AppObj.base_path)

    # 文件夹不存在则创建
    FileUtil.create_dir_not_exist(setting.file_path)

    SettingUtil.init_all()
    SettingUtil.read_all()
